/**
 * 
 */
package cc.rico.jms.spring.listener;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cc.rico.jms.spring.bean.CustomUser;

/**
 * @author rico 2016年7月31日
 *
 */
public class CustomConsumerMessageListener {
	private static final Logger logger = LoggerFactory.getLogger(CustomConsumerMessageListener.class);
	
	public void handleMessage(String message) {
		logger.info("message={}", message);
	}
	
	public void handleMessage(Message message) {
		if (message instanceof ObjectMessage) {
			ObjectMessage objMessage = (ObjectMessage) message;
			try {
				Object obj = objMessage.getObject();
				CustomUser user = (CustomUser) obj;
				logger.info("##CustomConsumerMessageListener.handleMessage##User={}", user);
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}  
	}
	
	public void handleMessage(CustomUser message) {
		logger.info("user={}", message);
	}
	
}
